package com.mocai.merchant.service;

import com.mocai.merchant.core.service.BaseService;
import com.mocai.merchant.mapper.MenuMapper;
import com.mocai.merchant.model.Menu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/1/7.
 */
@Service
public class MenuService extends BaseService<MenuMapper, Menu, Integer> {
    @Autowired
    MenuMapper menuMapper;

    public List<Menu> findByUserId(Integer userId) {
        return menuMapper.findByUserId(userId);
    }

    public List<Menu> findAll() {
        return menuMapper.selectAll();
    }

    public int deleteUserMenus(Integer userId) {
        return menuMapper.deleteUserMenus(userId);
    }

    public int addUserMenus(Integer userId, Integer[] menuIds) {
        return menuMapper.addUserMenus(userId, menuIds);
    }
}
